# -*- coding: utf-8 -*-
# File : config.py
# Author: taoyahui
# Date : 2021/10/17

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_cors import *
import redis

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql://root:123456@192.168.226.134:3306/logistics"
db = SQLAlchemy(app)
# r'/*' 是通配符，让本服务器所有的URL 都允许跨域请求
CORS(app, resources=r'/*')

admin_address = '0x261228c8b566be40d5595acb934f7583f2c39dad'
webase_host = "192.168.226.134"
contract_name = 'Logistics'
contract_address = '0xb841eecaec251de3e56af4dc296d92a2bf413483'
contract_abi= [{"constant":True,"inputs":[{"name":"companyAddress","type":"address"}],"name":"getProcueCompany","outputs":[{"name":"","type":"address"},{"name":"","type":"string"},{"name":"","type":"uint256[]"},{"name":"","type":"uint256[]"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"companyAddress","type":"address"},{"name":"companyName","type":"string"}],"name":"createProcureCompany","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"companyAddress","type":"address"}],"name":"getTransCompany","outputs":[{"name":"","type":"address"},{"name":"","type":"string"},{"name":"","type":"string"},{"name":"","type":"string"},{"name":"","type":"uint256[]"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"materials","type":"string"},{"name":"procureTime","type":"uint256"},{"name":"procurementCycle","type":"uint256"}],"name":"createProcureOrder","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"index","type":"uint256"}],"name":"getProcureOrder","outputs":[{"name":"","type":"string"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address[]"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"companyAddress","type":"address"},{"name":"companyName","type":"string"},{"name":"location","type":"string"},{"name":"bussinessScope","type":"string"}],"name":"createTransCompany","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"procureIndex","type":"uint256"},{"name":"procureCompany","type":"address"},{"name":"transCompany","type":"address"},{"name":"clearanceLocation","type":"string"},{"name":"entryLocation","type":"string"},{"name":"clearanceTime","type":"uint256"},{"name":"entryTime","type":"uint256"},{"name":"situation","type":"uint256"}],"name":"createTransOrder","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"index","type":"uint256"}],"name":"getTransOrder","outputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"string"},{"name":"","type":"string"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":False,"stateMutability":"view","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"}]
redis_service = redis.StrictRedis(host="192.168.226.134", port=6379, db=0)
